%{
	#include "customquadric.tab.h"
	#include "../expression/Constants.h"
	
	extern int yyerror(char* err);
	
	/* TODO : Advanced error gesture, unvalid variable, etc... */
%}

%%

"+" 						return PLUS;
"-"							return MINUS;
"*"							return MULTIPLY;
"/"							return DIVIDE;
"^"							return POW;
"|"							return ABS;
"("							return LEFTP;
")"							return RIGHTP;

"phi"|"theta"				{ yylval.str = yytext; return VARIABLE; }

"ln"						return LN;
"log"						return LOG;
"sin"						return SIN;
"cos"						return COS;

[0-9]+([\.][0-9]+)?		{ yylval.val = atof(yytext); return CONSTANT; }
"pi"		     			{ yylval.val = M_PI; return CONSTANT; }
"e"							{ yylval.val = M_E; return CONSTANT; }

"["							return LEFTB;
"]"							return RIGHTB;
";"							return SEMICOLON;

[ \t]+ 						;

"\n"						return NL;

.							{ yyerror("Parse error : unrecognized character."); }
